package com.leet.dp;

public class FindIntegers {
    int ans = 1;
    int max;
    public int findIntegers(int n) {
        max = n;
        dfs(1);
        return ans;
    }
    void dfs(int x){
        if(x > max){
            return;
        }
        ans++;
        if((x & 1) == 1) dfs(x << 1);
        else{
            dfs(x << 1);
            dfs(x <<1 |1);
        }
    }
}
